#!/usr/bin/perl

sub get_sysmon()
{
	open(FH, "/usr/bin/sensors |");
 	@sen = <FH>;
	close(FH);
        my $sysmon;
        for($i=0; $i<@sen; $i++) {
        	$sen[$i] =~ s/\r|\n//g;
        	$sen[$i] =~ s/\*|\t//g;
                if($sen[$i] =~ /(\+3\.3V:)\s+(\S+)\sV/){
        		push(@sysmon, $1.$2);	
		}
        	elsif($sen[$i] =~ /(\+5V:)\s+(\S+)\sV/) {
			push(@sysmon,$1.$2);
		}
		elsif($sen[$i] =~ /(-5V:)\s+(\S+)\sV/){
			push(@sysmon,$1.$2);
		}
		elsif($sen[$i] =~ /(\+12V:)\s+(\S+)\sV/){
			push(@sysmon,$1.$2);
		}
		elsif($sen[$i] =~ /(-12V:)\s+(\S+)\sV/){
			push(@sysmon,$1.$2);
		}
		elsif($sen[$i] =~ /(VBat:)\s+(\S+)\sV/){
			push(@sysmon,$1.$2);
		}
		elsif($sen[$i] =~ /(temp2:)\s+(\+\d+\.*\d*)\S+C/){
			push(@sysmon,$1.$2);
		}
                elsif($sen[$i] =~ /(temp3:)\s+(\+\d+\.*\d*)\S+C/){
                        push(@sysmon,$1.$2);
                }
	}
	return @sysmon;
}
get_sysmon();
foreach $i (@sysmon) {
	print $i."\n";
}
